Re: chroot'ed environment?

Valdis.Kletnieks@vt.edu
Thu, 20 Apr 1995 03:49:00 -0400

On Wed, 19 Apr 1995 17:47:13 EDT, you said:
> An idea which just occurred to me, not tested at all.  If you can
> connect() an AF_UNIX SOCK_DGRAM socket (and I'm not sure you can), the
> association with its peer might survive a chroot that renders the
> original pathname inaccessible.  If this is so, it could provide an
> answer.

Excerpted from 'man 3 openlog' on an AIX 3.2.5 system, but it should be
in any BSD4.3 system:

  #include <syslog.h>
  
  int openlog (ID, LogOption, Facility)
  char *ID;
  int LogOption, Facility;
...
  LogOption     Specifies a bit field that indicates logging options.
  The values of LogOption are:
...
  LOG_NDELAY    Opens the connection to the syslogd command immediate-
  ly, instead of when the first  message is logged.  This option is
  useful for  programs  that need to manage the order in which file
  descriptors are allocated.
...

So if you call  openlog(argv[0],LOG_NDELAY,LOG_DAEMON);  the LOG_NDELAY
will open /dev/log *now* (presumably before you chroot()).  And as we all
know, open file descriptors are not affected by a chroot()....

				Valdis Kletnieks
				Computer Systems Engineer
				Virginia Tech